<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
	<meta http-equiv="pragma" content="no-cache" />
	<link rel="stylesheet" href="/css/style.css" type="text/css"/>
	<script type="text/javascript" src="/js/jquery.js"></script>
	<script type="text/javascript" src="/js/util.js"></script>
</head>
<script type="text/javascript">
//////////////////////////////////////////////////////////////////////
////  email = "wenpin.qian@happyelements.com"                     ////
////  team = "Athene"                                             ////
////  warnings = "This is generated page,Do Not Modify!";         ////
////  tips = "Opera & IE not supported|Chrome & Safari sugguested"////
//////////////////////////////////////////////////////////////////////
window.returnValue=0;

$(document).ready(function() {
listselectors();
});

function addforge_item_data() {
	var addforge_item_dataUrl = "/forge_item_data/add/";
	var countValue = $("#count").val();
	if(!checkInteger("当前强化等级",countValue,false)) {
		return;
	}
	var countParam = "count=" + xparseInt(countValue);
		
	var minValue = $("#min").val();
	if(!checkInteger("最小概率",minValue,false)) {
		return;
	}
	var minParam = "min=" + xparseInt(minValue);
		
	var maxValue = $("#max").val();
	if(!checkInteger("最大概率",maxValue,false)) {
		return;
	}
	var maxParam = "max=" + xparseInt(maxValue);
		
	var goldValue = $("#gold").val();
	if(!checkInteger("消耗金币数",goldValue,false)) {
		return;
	}
	var goldParam = "gold=" + xparseInt(goldValue);
			
	$.ajax({
		   type: "POST",
		   url: addforge_item_dataUrl,
		   data:   countParam +'&'+ minParam +'&'+ maxParam +'&'+ goldParam ,
		   dataType: "json",
		   success: function(data) {
			   if(data.code > 0) {
			       window.returnValue=1;
			       beforeWindowClose();
				   window.close();
			   }else {
				  errDialog(data.message);
			   }
		   }
	});
}

function listselectors() {
}


function openResource(fieldname,dependfield) {
	var param = "";
	if(dependfield!="") {
		param = $("#" + dependfield).val()
		if(param == null || param == "") {
			alert("你先把【" + $("#lbl_" + dependfield).html() + "】填了再上传");
			return;
		}
	}
	resourceDialog("forge_item_data",$("#" + fieldname).val(),param,function(result) {
		if(result != undefined && result != "") {
			$("#" + fieldname).val(result);
		}
	});
}

function beforeWindowClose() {
	if(window.returnCallback) {
		window.returnCallback(window.returnValue);
	}
	window.onbeforeunload = null;
	return true;
}

</script>
<body onunload="beforeWindowClose()">
	<div class="addarea">
	<form action="/forge_item_data/add" method="post">
		<table>
			<tbody>				
					<tr>					<td>
						<label for="count" id="lbl_count">当前强化等级</label>
													<input type="text" id="count" name="count" /><span class="tips">[整数]</span>
											</td>
									
										<td>
						<label for="min" id="lbl_min">最小概率</label>
													<input type="text" id="min" name="min" /><span class="tips">[整数]</span>
											</td>
					</tr>				
					<tr>					<td>
						<label for="max" id="lbl_max">最大概率</label>
													<input type="text" id="max" name="max" /><span class="tips">[整数]</span>
											</td>
									
										<td>
						<label for="gold" id="lbl_gold">消耗金币数</label>
													<input type="text" id="gold" name="gold" /><span class="tips">[整数]</span>
											</td>
					</tr>							</tbody>
		</table>
		<input type="button" onclick="addforge_item_data()" value="添加"/>
	</form>
	</div>
</body>